
function upload(arr:any,callback:any){
	uni.showLoading({
		title:'上传中...',
		mask:true
	})
	var arr1 = []
	run(arr,0,arr1,callback)
	
}
function run(arr:any,index:number,arr1:any,callback:any){
	uni.uploadFile({
		url:getApp().globalData.baseUrl+'/app/file/uploadFile',
		fileType:arr[index].fileType || 'image',
		name: 'file',
		filePath: arr[index].filePath,
		success: (e:any) => {
			const data = JSON.parse(e.data)
			if(data.code == 200){
				arr1 = [...arr1,data.data]
				if(arr.length - 1 != index){
					run(arr,index+1,arr1,callback)
				}else{
					callback(arr1)
				}
			}else{
				uni.showToast({
					title:e.data.message,
					icon:'none'
				})
			}
			if(arr.length - 1 == index){
				uni.hideLoading()
			}
		},
		fail:()=>{
			uni.hideLoading()
		}
	})
}
export default upload